/*餐饮管理api的页面*/
import request from '@/helpers/request'
import querystring from 'querystring' //序列化请求参数
let formatData = (data)=>{
  return querystring.stringify(data)
}//序列化请求参数 封装函数

const URL = {
  GET_LIST: 'csfw/app/cs/pageList1',
  UPDATE: 'csfw/app/cs/updateStatus',
  UPLOADIMG: 'csfw/app/cs/filesUpload',
  SAVE: 'csfw/app/cs/saveGood',
  DELETE:'csfw/app/cs/deleteByGoodsId',
  SAVETYPE:'csfw/app/cs/saveType',//添加菜品类别
  DELETETYPE:'csfw/app/cs/deleteType',//删除菜品类别
  //以上是第一模块
  IMPORTCP:'csfw/app/cs/importGoods', //批量导入
  PAGE:'csfw/app/cs/pageOrderList',
  GOODINFO:'csfw/app/cs/pageGoodsInfoList',
  EDITORDERQX:'csfw/app/cs/editOrderQx',
  CSEXCEL:'csfw/app/cs/csExcel',
  SELECTLOGS:"csfw/app/cs/selectLogs",
}

export default {
    getList(page,rows,treeNode,type,name) {
        return request(URL.GET_LIST, 'POST', formatData({ page,rows,treeNode:1,type,name}))
    },//获取餐厅列表
    uploadImg(myfiles,progress) {
        return request(URL.UPLOADIMG, 'POST', myfiles)
    },//上传图片
    save(form) {
        return request(URL.SAVE, 'POST', formatData(form))
    },//保存餐厅
    isOrderUpdate(id,type){
        return request(URL.UPDATE, 'POST', formatData({id,type}))
    },//是否预订
    delete(ids){
        return request(URL.DELETE, 'POST', formatData({ids:ids.join(',')}))
    },//删除餐厅
    //以上是第一模块
    getBalcony(refe,ycrq){
        return request(URL.SELECTBOX, 'POST', formatData({refe,ycrq}))
    },//获取包厢
    queryList(id){
        return request(URL.QUERYLIST + id, 'GET')
    },
    updateStatus(id,type){
        return request(URL.UPDATASTATE, 'POST', formatData({id,type}))
    },//更新状态
    saveBox(form){
        return request(URL.SAVEBOX, 'POST', formatData(form))
    },
    importCP(form){
        return request(URL.IMPORTCP, 'POST', form)
    },
    saveType(name,marketId){
        return request(URL.SAVETYPE, 'POST',formatData({name,marketId}))
    },
    deleteType(ids){
        return request(URL.DELETETYPE, 'POST',formatData({ids}))
    },
    findOrder(treeNode,page,rows,input,index){
        return request(URL.PAGE, 'POST',formatData({treeNode,page,rows,input,index}))
    },
    findGoodsInfoList(orderId,invoiceId){
        return request(URL.GOODINFO, 'POST',formatData({orderId,invoiceId}))
    },
    csqx(orderId){
        return request(URL.EDITORDERQX, 'POST',formatData({orderId}))
    },
    csexcel(id){
        return request(URL.CSEXCEL, 'POST',formatData({id}))
    },
    selectLogs(page,rows,username,){
        return request(URL.SELECTLOGS,'POST',formatData({page,rows,username,}))  
        
    }

}